//
//  ContentViewController.m
//  Menu
//
//  Created by YR on 2017/5/31.
//  Copyright © 2017年 YR. All rights reserved.
//

#import "ContentViewController.h"

#import "NavigationView.h"

@interface ContentViewController ()

@property (nonatomic) UITabBarController *tabC;
@property (nonatomic) NavigationView *naviView;

@end

@implementation ContentViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self.navigationController setNavigationBarHidden:YES animated:YES];
    
    _naviView = [[NavigationView alloc] init];
//    [self.view addSubview:_naviView];
    
    UITabBarController *tabC = [[UITabBarController alloc] init];
    [self addChildViewController:tabC];
    [self.view addSubview:tabC.view];
    _tabC = tabC;
    
    UIViewController *vc1 = [[UIViewController alloc] init];
    vc1.view.backgroundColor = [UIColor orangeColor];
    [self addChildVC:vc1 title:@"test1" imageName:@"" selectImage:@""];
    
    UIViewController *vc2 = [[UIViewController alloc] init];
    vc2.view.backgroundColor = [UIColor blueColor];
    [self addChildVC:vc2 title:@"test2" imageName:@"" selectImage:@""];
    
    UIViewController *vc3 = [[UIViewController alloc] init];
    vc3.view.backgroundColor = [UIColor greenColor];
    [self addChildVC:vc3 title:@"test3" imageName:@"" selectImage:@""];
    
    [tabC.view addSubview:_naviView];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}


- (void)addChildVC:(UIViewController *)ChildVC title:(NSString *)title imageName:(NSString *)imageName selectImage:(NSString *)selectImage
{
    //设置文本
    ChildVC.tabBarItem.title = title;
    
    //设置默认图标
    ChildVC.tabBarItem.image = [UIImage imageNamed:imageName];
    //设置字体颜色
    _tabC.tabBar.tintColor = [UIColor blackColor];
    
    _tabC.tabBar.translucent = NO;
    
    //设置选中图标
    ChildVC.tabBarItem.selectedImage = [UIImage imageNamed:selectImage];
    //    ChildVC.tabBarItem.imageInsets = UIEdgeInsetsMake(5, 0, -5, 0);
    ChildVC.tabBarItem.image = [ChildVC.tabBarItem.image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    
    self.tabBarController.tabBar.translucent = NO;
    [_tabC addChildViewController:ChildVC];
}


@end
